package android.support.v4.app;

import android.support.v4.a.b;
import android.support.v4.c.c;
import android.util.Log;
import java.io.PrintWriter;
import java.lang.reflect.Modifier;

final class w extends u
{
  static boolean a = false;
  final c b;
  final c c;
  final String d;
  FragmentActivity e;
  boolean f;
  boolean g;

  public final void a(String paramString, PrintWriter paramPrintWriter)
  {
    x localx;
    int j = 0;
    if (this.b.a() > 0)
    {
      paramPrintWriter.print(paramString);
      paramPrintWriter.println("Active Loaders:");
      str = paramString + "    ";
      i = 0;
      while (i < this.b.a())
      {
        localx = (x)this.b.b(i);
        paramPrintWriter.print(paramString);
        paramPrintWriter.print("  #");
        paramPrintWriter.print(this.b.a(i));
        paramPrintWriter.print(": ");
        paramPrintWriter.println(localx.toString());
        localx.a(str, paramPrintWriter);
        i += 1;
      }
    }
    if (this.c.a() <= 0)
      return;
    paramPrintWriter.print(paramString);
    paramPrintWriter.println("Inactive Loaders:");
    String str = paramString + "    ";
    int i = j;
    while (i < this.c.a())
    {
      localx = (x)this.c.b(i);
      paramPrintWriter.print(paramString);
      paramPrintWriter.print("  #");
      paramPrintWriter.print(this.c.a(i));
      paramPrintWriter.print(": ");
      paramPrintWriter.println(localx.toString());
      localx.a(str, paramPrintWriter);
      i += 1;
    }
  }

  public final boolean a()
  {
    int k = this.b.a();
    int i = 0;
    int l = 0;
    if (i < k)
    {
      x localx = (x)this.b.b(i);
      if ((localx.h) && (!(localx.f)));
      for (int j = 1; ; j = 0)
        while (true)
        {
          l |= j;
          i += 1;
        }
    }
    return l;
  }

  final void b()
  {
    int i;
    if (a)
      Log.v("LoaderManager", "Starting in " + this);
    if (this.f)
    {
      localObject = new RuntimeException("here");
      ((RuntimeException)localObject).fillInStackTrace();
      Log.w("LoaderManager", "Called doStart when already started: " + this, (Throwable)localObject);
    }
    do
    {
      return;
      this.f = true;
      i = this.b.a() - 1;
    }
    while (i < 0);
    Object localObject = (x)this.b.b(i);
    if ((((x)localObject).i) && (((x)localObject).j))
      ((x)localObject).h = true;
    while (true)
    {
      while (true)
        i -= 1;
      if (((x)localObject).h)
        continue;
      ((x)localObject).h = true;
      if (a)
        Log.v("LoaderManager", "  Starting: " + localObject);
      if ((((x)localObject).d == null) && (((x)localObject).c != null))
        ((x)localObject).d = ((x)localObject).c.a();
      if (((x)localObject).d == null)
        continue;
      if ((((x)localObject).d.getClass().isMemberClass()) && (!(Modifier.isStatic(((x)localObject).d.getClass().getModifiers()))))
        throw new IllegalArgumentException("Object returned from onCreateLoader must not be a non-static inner member class: " + ((x)localObject).d);
      if (!(((x)localObject).m))
      {
        ((x)localObject).d.a(((x)localObject).a, (b)localObject);
        ((x)localObject).m = true;
      }
      ((x)localObject).d.a();
    }
  }

  final void c()
  {
    if (a)
      Log.v("LoaderManager", "Stopping in " + this);
    if (!(this.f))
    {
      RuntimeException localRuntimeException = new RuntimeException("here");
      localRuntimeException.fillInStackTrace();
      Log.w("LoaderManager", "Called doStop when not started: " + this, localRuntimeException);
      return;
    }
    int i = this.b.a() - 1;
    while (i >= 0)
    {
      ((x)this.b.b(i)).a();
      i -= 1;
    }
    this.f = false;
  }

  final void d()
  {
    Object localObject;
    if (a)
      Log.v("LoaderManager", "Retaining in " + this);
    if (!(this.f))
    {
      localObject = new RuntimeException("here");
      ((RuntimeException)localObject).fillInStackTrace();
      Log.w("LoaderManager", "Called doRetain when not started: " + this, (Throwable)localObject);
      return;
    }
    this.g = true;
    this.f = false;
    int i = this.b.a() - 1;
    while (true)
    {
      if (i >= 0);
      localObject = (x)this.b.b(i);
      if (a)
        Log.v("LoaderManager", "  Retaining: " + localObject);
      ((x)localObject).i = true;
      ((x)localObject).j = ((x)localObject).h;
      ((x)localObject).h = false;
      ((x)localObject).c = null;
      i -= 1;
    }
  }

  final void e()
  {
    int i = this.b.a() - 1;
    while (i >= 0)
    {
      ((x)this.b.b(i)).k = true;
      i -= 1;
    }
  }

  final void f()
  {
    int i = this.b.a() - 1;
    while (i >= 0)
    {
      x localx = (x)this.b.b(i);
      if ((localx.h) && (localx.k))
      {
        localx.k = false;
        if (localx.e)
          localx.a(localx.d, localx.g);
      }
      i -= 1;
    }
  }

  final void g()
  {
    if (!(this.g))
    {
      if (a)
        Log.v("LoaderManager", "Destroying Active in " + this);
      i = this.b.a() - 1;
      while (i >= 0)
      {
        ((x)this.b.b(i)).b();
        i -= 1;
      }
    }
    if (a)
      Log.v("LoaderManager", "Destroying Inactive in " + this);
    int i = this.c.a() - 1;
    while (i >= 0)
    {
      ((x)this.c.b(i)).b();
      i -= 1;
    }
    this.c.b();
  }

  public final String toString()
  {
    StringBuilder localStringBuilder = new StringBuilder(128);
    localStringBuilder.append("LoaderManager{");
    localStringBuilder.append(Integer.toHexString(System.identityHashCode(this)));
    localStringBuilder.append(" in ");
    android.support.v4.c.a.a(this.e, localStringBuilder);
    localStringBuilder.append("}}");
    return localStringBuilder.toString();
  }
}